package cn.cvs.test;

import Color.Printer;
import cn.springdemo.HelloSpring;
import entity.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.UserService;

public class deep {
     @Test
    public void testHelloSpring() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
         HelloSpring helloSpring=(HelloSpring)context.getBean("helloSpring");
         helloSpring.print();
    }

    @Test
    public void aopTest(){
         ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService service=(UserService) ctx.getBean("userService");
        User user=new User();
        user.setId(1);
        user.setUserName("test");
        user.setPassword(123456);
        user.setEamil("ttest@xxx.com");
        service.save(user);
    }
    @Test
    public void printerTest(){
         ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        Printer printer=(Printer) context.getBean("printer");
        String content="轻灵 轻灵的鼠标一点\n" +
                "\n" +
                "神奇的世界出现\n" +
                "\n" +
                "双手 把双手放在胸前\n" +
                "\n" +
                "敲打出美丽的画卷\n" +
                "\n" +
                "轻灵 轻灵的鼠标一点\n" +
                "\n" +
                "神奇的世界出现\n" +
                "\n" +
                "双手 把双手放在胸前\n" +
                "\n" +
                "敲打出美丽的画卷\n" +
                "\n" +
                "是谁让IT生活多彩绚烂\n" +
                "\n" +
                "青鸟在我们身边\n" +
                "\n" +
                "纵然是IT时代风云变幻\n" +
                "\n" +
                "青鸟青鸟与我们相伴\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "将知识在神州大地撒遍\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "让教育改变我们的生活\n" +
                "\n" +
                "是你帮助了我们实现了心愿\n" +
                "\n" +
                "又是你让我们的世界变成无限\n" +
                "\n" +
                "轻灵 轻灵的鼠标一点\n" +
                "\n" +
                "神奇的世界出现\n" +
                "\n" +
                "双手 把双手放在胸前\n" +
                "\n" +
                "敲打出美丽的画卷\n" +
                "\n" +
                "是谁让IT生活多彩绚烂\n" +
                "\n" +
                "青鸟在我们身边\n" +
                "\n" +
                "纵然是IT时代风云变幻\n" +
                "\n" +
                "青鸟 青鸟与我们相伴\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "将知识在神州大地撒遍\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "让教育改变我们的生活\n" +
                "\n" +
                "是你帮助了我们实现了心愿\n" +
                "\n" +
                "又是你让我们的世界变成无限\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "将知识在神州大地撒遍\n" +
                "\n" +
                "飞旋吧青鸟\n" +
                "\n" +
                "让教育改变我们的生活\n" +
                "\n" +
                "是你帮助了我们实现了心愿\n" +
                "\n" +
                "又是你让我们的世界变成无限\n" +
                "\n" +
                "因为有你，地更广阔天更蓝";
        printer.print(content);
    }
}
